# The user needs to assign these for their project
CCFILESS=server.cc
CCFILESC=client.cc
EXECS=server
EXECC=client

# The included dependency file contains all the incremental compilation info,
# however we use the implicit rule for making each one which is (simplified):
# g++ $(CXXFLAGS) -c -o Foo.o Foo.cc
# Thus we place our compiler flags into this default variable
CXXFLAGS=-Wall
# Create all the needed .o file names from the .cc files
OFILESS=$(CCFILESS:.cc=.o)
OFILESC=$(CCFILESC:.cc=.o)
# The main linking rule
$(EXECS): $(OFILESS)
	g++ -o $(EXECS) $(OFILESS)
$(EXECC): $(OFILESC)
	g++ -o $(EXECC) $(OFILESC)
# Clean not only cleans up object files, but also recreates the dependency file
clean:
	rm -f *~
	rm -f *.o
	rm -f $(EXECS)
	rm -f $(EXECC)
	g++ $(CCFILESS) -MM > $(EXECS).d
	g++ $(CCFILESC) -MM > $(EXECC).d
# Always include the dependency file unless we run the clean command,
# which will make it even if it does not exist
ifneq ($(MAKECMDGOALS), clean)
include $(EXECS).d
include $(EXECC).d
endif
